package designpatern;

/**
 * Created on 2021/1/5 。
 *
 * @author wll 1978992154@qq.com
 */

/**
 * 单列模式
 */
public class SingletonPattern {
}


class SingletonNo1{
    // 限制产生多个对象
    private static final SingletonNo1 singleton = new SingletonNo1();

    public SingletonNo1() {
    }

    //通过该方法获得实例对象
    public static SingletonNo1 getSingleton() {
        return singleton;
    }
    //类中其他方法，尽量是 static
    public static void doSomething(){
    }
}